#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.

touch /var/lock/subsys/local



################
# cloudjunit

# assumes that /home/ec2-user/cloudjunit/ contains: s3down.jar, config.properties (updated)

# download from s3: ah.jar, wh.jar, aspecjweaver.jar
mkdir /tmp/cloudjunit/
cd /home/ec2-user/cloudjunit/
java -jar /home/ec2-user/cloudjunit/s3down.jar	prjfiles/aspectjweaver.jar	/tmp/cloudjunit/aspectjweaver.jar	>> /tmp/cloudjunit/s3down.out.txt 2>&1
java -jar /home/ec2-user/cloudjunit/s3down.jar	prjfiles/ah.jar	/tmp/cloudjunit/ah.jar	>> /tmp/cloudjunit/s3down.out.txt 2>&1
java -jar /home/ec2-user/cloudjunit/s3down.jar	prjfiles/wh.jar	/tmp/cloudjunit/wh.jar	>> /tmp/cloudjunit/s3down.out.txt 2>&1

# copy config file
cp /home/ec2-user/cloudjunit/config.properties /tmp/cloudjunit/config.properties

# start workers
cd /tmp/cloudjunit
java -javaagent:aspectjweaver.jar -jar ah.jar noReadInput &
java -javaagent:aspectjweaver.jar -jar ah.jar noReadInput &

java -javaagent:aspectjweaver.jar -jar wh.jar noReadInput &
